home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_020 / disksalv / poster < prev   
Text File  |  1992-05-06  |  5KB  |  103 lines

  1. Article 1684 of net.micro.amiga:
  2. Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site unisoft.UUCP
  3. Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site cbmvax.cbmvax.cbm.UUCP
  4. Path: unisoft!lll-lcc!qantel!intelca!oliveb!hplabs!sdcrdcf!burdvax!bpa!cbmvax!daveh
  5. From: daveh@cbmvax.UUCP
  6. Newsgroups: net.micro.amiga
  7. Subject: Disk Salvage Program
  8. Message-ID: <165@cbmvax.cbmvax.cbm.UUCP>
  9. Date: 29 Apr 86 22:34:38 GMT
  10. Date-Received: 3 May 86 04:14:16 GMT
  11. Reply-To: daveh@cbmvax.UUCP (Dave Haynie)
  12. Organization: Commodore Technology, West Chester, PA
  13. Lines: 1074
  14. Keywords: DISK SALVAGE
  15.  
  16.  
  17. The following is a program I've written to recover files from a trashed
  18. AmigaDOS disk.  It requires the Lattice C compiler to compile, I haven't
  19. tried it with any other.  It also requires two drives to do the actual
  20. recovery. This program is designed to let the user salvage all or parts
  21. of a damaged AmigaDOS disk.  It is used similarly to the standard AmigaDOS
  22. DISKCOPY or COPY programs, with the format:
  23.  
  24.         DISKSALV dfN: [TO] dfM:
  25.  
  26. Where the source disk is the corrupted disk, the target disk is    a formatted
  27. AmigaDOS disk, usually (but not necessarily) empty.  This command currently
  28. takes two drives; i.e. it won't salvage df0: to df0: or to RAM:.  This 
  29. program salvages the bad disk by by-passing the normal disk root directory, 
  30. which may be corrupted (and as well is probably the most likely cause of a 
  31. complete disk being rejected by AmigaDOS).  It performs a scan to collect
  32. all directories and their associated files, building an internal dynamic
  33. image of the bad disk.  Then each directory found is created through normal
  34. DOS calls, then the files belonging to that directory are placed under it
  35. via block copies from bad disk to good disk.  When creating a new directory,
  36. the program will check for the prior existance of such a directory.  If it
  37. already exists, the intended name will be modified slightly.  After 10 of
  38. these attempted name changes, the program will abort the attempt to write
  39. out the directory.  This allows a non-empty disk to easily be used for the
  40. output disk without having to worry about overwriting directories currently
  41. existing on the output disk.
  42.  
  43. This copy routine is smart, and will attempt to resolve any corrupted file
  44. links using the redundant information in AmigaDOS.  Every AmigaDOS file has
  45. a header containing a list of block pointers, and a first block pointer.  
  46. This first pointer is a link to the first 512 byte data block in the file.
  47. This first link is also echoed in the aforementioned list of block pointers.
  48. Each subsequent data block has a link to the next block which as well can
  49. be verified by the block pointer list.  Data blocks also contain sequence
  50. numbers, indicating their logical sequence in the file, and backpointers to
  51. the file header block.  These last two items are constantly checked, and
  52. are very good in helping to resolve any next block conflicts that might
  53. arise.  The copy routine can resolve as well missing blocks and circularly
  54. linked files reasonably well.
  55.  
  56. The process continues until no more files/directories exist.  There is no
  57. necessary correlation between the physical location of files on the bad
  58. disk and the physical location of the corresponding files on the newly
  59. created disk.  Once all linkable files are restored, a directory of
  60. existing but not yet used data blocks is created, in an effort to preserve
  61. anything left, which might be manually re-created for a file that had its
  62. file header badly destroyed.  These will appear in a uniquely named
  63. SPARE-BLOCKS directory.  Each file in that directory will have a name
  64. indicating the block's block number, parent block number, and sequence
  65. number.  Any program source or other ASCII text can be easily put together
  66. by hand by following the proper sequence among files of similar parentage
  67. if desired, either in an editor or via the Join command.  Any binary files
  68. may be re-assembled similarly, but unless all of the blocks in the file are
  69. available, the reassembled file will generally be useless.
  70.  
  71. This program will also copy a good disk, though inefficiently as compared
  72. to a straight Copy command.  Also, this program recovers files that have
  73. been deleted but not yet written over.  Thus, it can be used to recover
  74. deleted (but not overwritten) files.  If the output disk gets filled up
  75. completely at any time, the program will pause you and request another
  76. disk for the output disk.  Actually, the first time the disk becomes full,
  77. the system will pop up with a requestor box indicating that the disk has
  78. become full.  Click the "CANCEL" box here and a prompt on the CLI comes up
  79. requesting a change of disks.  It will then recreate the currently active 
  80. directory path, and the file that it was working on before the swap took
  81. place.  Everything from this point on proceeds as normal.
  82.  
  83.                     -Dave Haynie
  84.                      April 1986
  85.  
  86.  
  87.     "I gained nothing at all from Supreme Enlightenment, and
  88.      for that very reason it is called Supreme Enlightenment."
  89.  
  90.                     -Gotama Buddha
  91.  
  92.     "Let me control a planet's oxygen supply and I don't care
  93.      who makes the laws."
  94.  
  95.                     -Great Cthulhu's Starry Wisdom Band
  96.  
  97. -- 
  98.  
  99. Dave Haynie    {caip,inhp4,allegra,seismo}!cbmvax!daveh
  100.                "There, beyond the bounds of your weak imagination
  101.                 Lie the noble towers of my city, bright and gold"
  102.                                 -Genesis
  103.